﻿

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>新增用户</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="../../../layuiadmin/layui/css/layui.css" media="all">
</head>
<body>

    <div class="layui-form" lay-filter="layuiadmin-form-useradmin" id="layuiadmin-form-useradmin" style="padding: 20px 0 0 0;">
        <div class="layui-form-item">
            <label class="layui-form-label">登录账号</label>
            <div class="layui-input-inline">
                <input type="text" name="txt_loginid" id="txt_loginid" lay-verify="required" placeholder="请输入登录账号" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">用户名</label>
            <div class="layui-input-inline">
                <input type="text" name="txt_username" id="txt_username" lay-verify="required" placeholder="请输入用户名" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">密码</label>
            <div class="layui-input-inline">
                <input type="password" name="password" id="password" lay-verify="required" placeholder="请输入密码" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">联系人名称</label>
            <div class="layui-input-inline">
                <input type="text" name="customername" id="customername" lay-verify="required" placeholder="经销商联系人" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">手机号码</label>
            <div class="layui-input-inline">
                <!--<input type="text" name="phone" id="phone" lay-verify="phone" placeholder="请输入手机号码" autocomplete="off" class="layui-input">-->
                <input type="text" name="phone" id="phone" placeholder="请输入手机号码" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">邮箱</label>
            <div class="layui-input-inline">
                <input type="text" name="email" id="email" placeholder="请输入邮箱" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">管理区域</label>
                <div class="layui-input-block">
                    <select name="sel_manageqy" id="sel_manageqy"></select>
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">负责业务</label>
                <div class="layui-input-block">
                    <select name="sel_manageyw" id="sel_manageyw"></select>
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">负责商品</label>
                <div class="layui-input-block">
                    <select name="sel_managesp" id="sel_managesp"></select>
                </div>
            </div>
        </div>
            <!--<div class="layui-form-item">
            <label class="layui-form-label">头像</label>
            <div class="layui-input-inline">
                <input type="text" name="imgurl" id="imgurl" readonly="readonly" placeholder="请上传头像" autocomplete="off" class="layui-input">
            </div>
            <button style="float: left;" type="button" class="layui-btn" id="layuiadmin-upload-useradmin">上传图片</button>
        </div>-->
            <!--<div class="layui-form-item">
            <label class="layui-form-label">管辖店铺</label>
            <div class="layui-input-inline">
                <textarea name="managestore" rows="5" readonly="readonly" lay-verify="required" id="managestore" placeholder="请选择管辖店铺" class="layui-textarea"></textarea>
                <input id="storeid" class="form-control" name="uid" type="hidden" value="">
            </div>
            <button style="float: left;" type="button" onclick="select_store()" data-type="add" class="layui-btn">选择管辖店铺</button>
        </div>-->
            <div class="layui-form-item">
                <label class="layui-form-label">角色</label>
                <div class="layui-input-inline">
                    <select name="sel_roles" id="sel_roles" lay-filter="LAY-user-adminrole-type"></select>
                </div>
            </div>
            <div class="layui-form-item" lay-filter="sex">
                <label class="layui-form-label">选择性别</label>
                <div class="layui-input-block">
                    <input type="radio" name="sex" value="男" title="男" checked>
                    <input type="radio" name="sex" value="女" title="女">
                </div>
            </div>
            <div class="layui-form-item" lay-filter="look">
                <label class="layui-form-label">查看权限</label>
                <div class="layui-input-block">
                    <input type="checkbox" id="islookme" checked="" name="islookme" lay-skin="switch" lay-filter="component-form-switchTest" lay-text="全部|自己">
                </div>
            </div>
            <div class="layui-form-item" lay-filter="sex">
                <label class="layui-form-label">是否可用</label>
                <div class="layui-input-block">
                    <input type="checkbox" id="isactive" checked="" name="open" lay-skin="switch" lay-filter="component-form-switchTest" lay-text="可用|禁用">
                </div>
            </div>
            <div class="layui-form-item layui-hide">
                <input type="button" lay-submit lay-filter="LAY-user-front-submit" id="LAY-user-front-submit" value="确认">
            </div>
        </div>
        <script src="../../../layuiadmin/js/jquery.min2.1.4.js"></script>
        <script src="../../../layuiadmin/layui/layui.js"></script>
        <script src="../../../layuiadmin/js/jshelp.js"></script>
        <script>
            var arr_id = {};
            function select_store() {
                layer.open({
                    type: 2
                    , title: '选择管辖店铺'
                    , content: 'select_store.html'
                    , maxmin: true
                    , area: ['600px', '550px']
                    , btn: ['确定', '取消']
                    , yes: function (index, layero) {
                        var iframeWindow = window['layui-layer-iframe' + index]
                            , submitID = 'LAY-user-front-submit'
                            , submit = layero.find('iframe').contents().find('#' + submitID);
                        //监听提交
                        iframeWindow.layui.form.on('submit(' + submitID + ')', function (data) {
                            var obj = $(layero).find("iframe")[0].contentWindow;
                            var mJson = eval(obj.$('#uidsub').val());//获取子页面控件绑定的值
                            arr_id = new Array();
                            var arr_name = new Array();
                            for (var i = 0; i < mJson.length; i++) {
                                arr_id.push(mJson[i].value);
                                arr_name.push(mJson[i].title);
                            }
                            arr_id.join(",");
                            arr_name.join(",");
                            $('#managestore').val(arr_name);
                            $('#storeid').val(arr_id);
                            layer.close(index); //关闭弹层
                        });

                        submit.trigger('click');
                    }
                });
            }
            layui.config({
                base: '../../../layuiadmin/' //静态资源所在路径
            }).extend({
                index: 'lib/index' //主入口模块
            }).use(['index', 'form', 'upload'], function () {
                var $ = layui.$
                    , form = layui.form
                    , upload = layui.upload;
                //加载权限选项下拉框
                $.ajax({
                    type: "post",
                    url: "ashx/list.ashx?type=get_roles",
                    dataType: "json",
                    async: false,
                    success: function (data) {
                        var html = '';
                        if (data.data.length == 0) {
                            html += "<option value=''>无数据</option>";
                            $("#sel_roles").empty().append(html);
                        } else {
                            html += "<option value=''>请选择数据</option>";
                            for (var i = 0; i < data.data.length; i++) {
                                html += "<option value='" + data.data[i].id + "'>" + data.data[i].rolesname + "</option>"
                            }
                            $("#sel_roles").empty().append(html);
                        }
                        form.render();
                    },
                    error: function (data) {
                        layer.error(data);
                    }
                });
                //加载管理区域选项下拉框
                $.ajax({
                    type: "post",
                    url: "ashx/list.ashx?type=get_manageqy",
                    dataType: "json",
                    async: false,
                    success: function (data) {
                        var html = '';
                        if (data.data.length == 0) {
                            html += "<option value=''>无数据</option>";
                            $("#sel_manageqy").empty().append(html);
                        } else {
                            html += "<option value=''>请选择数据</option>";
                            for (var i = 0; i < data.data.length; i++) {
                                html += "<option value='" + data.data[i].id + "'>" + data.data[i].typename + "</option>"
                            }
                            $("#sel_manageqy").empty().append(html);
                        }
                        form.render();
                    },
                    error: function (data) {
                        layer.error(data);
                    }
                });
                //加载管理业务选项下拉框
                $.ajax({
                    type: "post",
                    url: "ashx/list.ashx?type=get_manageyw",
                    dataType: "json",
                    async: false,
                    success: function (data) {
                        var html = '';
                        if (data.data.length == 0) {
                            html += "<option value=''>无数据</option>";
                            $("#sel_manageyw").empty().append(html);
                        } else {
                            html += "<option value=''>请选择数据</option>";
                            for (var i = 0; i < data.data.length; i++) {
                                html += "<option value='" + data.data[i].id + "'>" + data.data[i].typename + "</option>"
                            }
                            $("#sel_manageyw").empty().append(html);
                        }
                        form.render();
                    },
                    error: function (data) {
                        layer.error(data);
                    }
                });
                //加载商品选项下拉框
                $.ajax({
                    type: "post",
                    url: "ashx/list.ashx?type=get_managesp",
                    dataType: "json",
                    async: false,
                    success: function (data) {
                        var html = '';
                        if (data.data.length == 0) {
                            html += "<option value=''>无数据</option>";
                            $("#sel_managesp").empty().append(html);
                        } else {
                            html += "<option value=''>请选择数据</option>";
                            for (var i = 0; i < data.data.length; i++) {
                                html += "<option value='" + data.data[i].id + "'>" + data.data[i].typename + "</option>"
                            }
                            $("#sel_managesp").empty().append(html);
                        }
                        form.render();
                    },
                    error: function (data) {
                        layer.error(data);
                    }
                });
                //创建上传组件
                //upload.render({
                //    elem: '#layuiadmin-upload-useradmin',
                //    url: '../../../ashx/upload_img.ashx',
                //    dataType: "json",
                //    accept: 'images', //允许上传的文件类型
                //    acceptMime: 'image/*',
                //    size: 1000, //最大允许上传的文件大小,
                //    data: function () {
                //        //请求上传接口的额外参数
                //    },
                //    done: function (res) {
                //        if (res.code === "100") {
                //            layer.msg(res.msg);
                //            $("#imgurl").val(res.url);
                //        } else {
                //            layer.msg(res.msg);
                //        }
                //    },
                //    error: function () {
                //        layer.msg("请求异常！");
                //    }
                //});
            })
        </script>
</body>
</html>